#override("title")
CiaoTalking - 客服管理
#end
#override("css")
<link href="#springUrl('/static/css/plugins/bootstrap-table/bootstrap-table.min.css')" rel="stylesheet">
#end
#override("breadcrumb")
<li><a>客服管理</a></li><li class="active"><strong>意见列表</strong></li>
#end
#override("content")
<div class="row">
	<div class="ibox-content text-right form-inline" style="background: #F3F3F4;">
		<div class="input-group">
            <span class="input-group-btn">
				<!--<select class="form-control m-b" name="sortSelect" id="sortSelect" onchange="changeType()" >
                    <option  selected="selected">排序</option>
                    <option value="dateOfBirth" >生日</option>
                    <option value="skinType" >肤质</option>
                    <option value="shardCount" >分享数量</option>
                    <option value="shardBonus" >分享佣金</option>
                    <option value="evaluateCount" >点评数量</option>
                    <option value="evaluateBonus" >点评佣金</option>
                    <option value="state" >状态</option>
                </select>-->
			</span>
			<input type="text" id="searchKey" class="form-control">
			<span class="input-group-btn">
				<button type="button" id="searchItem" onclick="searchService()" class="btn btn-info">搜索</button>
			</span>
		</div>
	</div>
</div>
<div class="row">
    <div class="col-sm-12">
        <table id="dataTable"></table>
    </div>
</div>
#end
#override("js")
<script src="#springUrl('/static/js/plugins/bootstrap-table/bootstrap-table.min.js')"></script>
<script src="#springUrl('/static/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js')"></script>
<script src="#springUrl('/static/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js')"></script>
<script src="#springUrl('/static/plugins/layer-v2.2/layer/layer.js')"></script>
<script src="#springUrl('/static/js/base_list.js')"></script>
<script src="#springUrl('/static/js/common.js')"></script>
<script type="text/javascript">
    var dataUrl = "#springUrl('/service/getShopFeedbackList')";
    var dataColumns = [{
        field: 'id',
        title: '序号'
    }, {
        field: 'content',
        title: '主题'
    },{
        field: 'shopUser.nickname',
        title: '来源'
    },{
        field: 'createDate',
        title: '创建日期',
        formatter:function(value,row,index){
            return formatDate(value);
        }
    },{
        title: '操作',
        formatter: function (value, row, index) {
            var id = row.id;
            var state = row.itemState;
                return '<a class="btn btn-xs btn-warning" onclick="replyMessage('+id+')">查看消息</a> ';
                       /* '<a class="btn btn-xs btn-warning" onclick="delItem('+id+')"><i class="fa fa-remove"></i>删除</a>'*/
        }
    },{
        field:'readDate',
        title: '消息状态',
        formatter: function (value, row, index) {
            if(value==null){
                return '<label class="btn btn-xs btn-info" >未读</label> ';
            }
            if(value!=null){
                return "已读";
            }
        }
    }
    ];

    /*function changeStateItem(itemId,type) {
        //询问框
        var state;
        if(type==1){
            state=='上架';
        }
        if(type==0){
            state='下架';
        }
        layer.confirm('确定'+state+'吗？', {
            btn: ['确定', '取消'] //按钮
        }, function () {
            $.ajax({
                type: "POST",
                url: "#springUrl('/item/changeStateItem')" + itemId,
                datatype: "text",
                success: function (data) {
                    if(data == 'true'){
                        $('#dataTable').bootstrapTable('refresh',{url:dataUrl});
                    }
                    layer.closeAll();
                }
            });
        }, function () {
            return;
        });
    }*/

    /*function recoverItem(itemId){
        if(itemId!=null){
            layer.confirm('确定恢复吗？',{btn:['确定','取消']},
                    function(){
                        $.ajax({
                            type:"POST",
                            url:"#springUrl('/item/recoverItem/')"+itemId,
                            dataType:"text",
                            success:function(data){
                                if(data=='true'){
                                    $("#dataTable").bootstrapTable('refresh',{url:dataUrl});
                                }
                                layer.closeAll();
                            }
                        });
                    },
                    function(){
                        return;
                    }
            );
        }
    }*/

    function delItem(itemId){
        if(itemId!=null){
            layer.confirm('确定删除吗？',{btn:['确定','取消']},
                function(){
                    $.ajax({
                        type:"POST",
                        url:"#springUrl('/item/delItem/')"+itemId,
                        dataType:"text",
                        success:function(data){
                            if(data=='true'){
                                $("#dataTable").bootstrapTable('refresh',{url:dataUrl});
                            }
                            layer.closeAll();
                        }
                    });
                },
                function(){
                    return;
                }
            );
        }
    }


function replyMessage(feedbackId){
   	var title = "消息内容";
   		url = "#springUrl('/service/reply')?feedbackId=" + feedbackId;
    layer.open({
        type: 2,
        title: title,
        shadeClose: false,
        shade: 0.8,
        area: ['700px', '600px'],
        fix: false,
        maxmin: true,
        content: url
    });
}

    function searchService(){
        var str = $.trim($("#searchKey").val());
        var searchKey = str.split(" ").join("");
        var url = "#springUrl('/service/getShopFeedbackList')"+"?searchKey="+searchKey;
        $("#dataTable").bootstrapTable("refresh",{url:url});
    }
</script>
#end
#extends("/common/framework.html")
